/**
 * Created by no1 on 2014/9/27.
 */

module.exports = {
  /*
   * server configure
   */

//  bindingApiHost: 'api.mahoo.cn',
  apiPort: 1888,

//  bindingWebHost: '', //www.mahoo.cn
//  webPort: 7001,
//
//  bindingManApiHost: 'admin.mahoo.cn',
//  manapiPort: 7002,

  // debug mode
  // if in debug mode, some middleware like limit wont load
  // logger module will print to stdout
  debug: true,

  // 字词过滤服务器配置
  wordFilter: {
    unix_socket: '/tmp/wordFilter.sock'
  },

  //根据用户post内容，机器自动分类
  autocate: {
    host: (process.env.CS_CLASSIFITER || '127.0.0.1'),
    port: 880,
    path: '/',
    inner_cate: [39],//内部使用圈子，手机端推荐时需要过滤
    default_cate: {name: '随便聊聊', cid: 0}, //默认的推荐圈子
    percent: 0.10  //推荐比例的下限，低于该比例的结果不与推荐
  },

  /**
   * elastic search config
   */
  elasticSearch: {
    //"host": "192.168.61.10:9200",
    host: (process.env.CS_ES || '127.0.0.1') + ':9200',
    index: "o2o"
  },

  // 上传用户脸的url
  face: {
    upUserFace: 'http://192.168.61.10:882/api/v1/face/user/upload',
    getAllParts: 'http://192.168.61.10:882/api/v1/face/parts/all?token=%token',
    renderUrl:'http://192.168.61.10:882/api/v1/face/render'
  },

  /**
   * mysql config
   */

  mysqlServers: [
    {
      //host: '192.168.61.37',
      //socketPath: '/tmp/mysql.sock',
      host: (process.env.CS_MYSQL || '127.0.0.1'),
      //host: '127.0.0.1',
      port: 3306,
      user: 'csapp',
      password: 'j1C9k3Mn'
    }
  ],
  mysqlDatabase: 'mahoo',
  mysqlMaxConnections: 20,
  mysqlQueryTimeout: 5000,


  // redis config
  // use for koa-limit module as storage
  redis: {
    //unix_socket: '/tmp/redis.sock',
    host: (process.env.CS_REDIS || 'localhost'),
    port: 6379,
    options: {
      //auth_pass: 'd53aOe1F9q'
    }
  },

//  upyun:{ //_prod 又拍云存储 生产环境
//    avatar_url: 'http://inmm-img.b0.upaiyun.com/avatar',
//    default_avatar_url: 'http://inmm-img.b0.upaiyun.com/avatar/default',
//    tag_url: 'http://inmm-img.b0.upaiyun.com/tag',
//    default_tag_url: 'http://inmm-img.b0.upaiyun.com/tag/default',
//    img_url   : 'http://inmm-img.b0.upaiyun.com/img',
//    bucket    : 'inmm-img',
//    api_secret: '6h4Z5LoH0JbgNNDVdeDP4ejvbqc=',
//    upload_url: 'http://v0.api.upyun.com',
//    suffix    : '!jpg600',
//    avatar_suffix: '.jpg!jpg300x300',
//
//    purge_url : 'http://purge.upyun.com/purge/',
//    user      : 'inmm01',
//    token     : '01ad63ee1239ebb3e47e5024d63166d5' //用户密码的md5
//  }

  upyun: { //又拍云存储 测试环境
    urlBase: 'http://img-test.yueniapp.com',  //基础路径 http://img-test.yueniapp.com
    urlTypePattern: /^(\w+)-(\d+)(-.+)?\.(jpg|png|gif|webp)$/,  //字符串匹配正则
    urlTypeArray: {  //字符串匹配正则后的映射URL
      S: {base: '/o2o/shop', pos: [3, 2, 2, 3], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//店面图路径，数据分段方法，随机数位数
      W: {base: '/o2o/ware', pos: [3, 2, 2, 3], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//商品图路径，数据分段方法，随机数位数
      V: {base: '/o2o/vendor', pos: [3, 2, 2, 3], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//商家详情页图片
      P: {base: '/img', pos: [3, 2, 2, 3], ran: 6, imgExt: ['jpg', 'jpeg', 'gif']},//帖子
      A: {base: '/avatar', pos: [3, 2, 2, 2], ran: 6, imgExt: ['jpg', 'jpeg']}, //头像
      T: {base: '/tag', pos: [3, 2, 2, 2], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//标签
      H: {base: '/h5/h', pos: [3, 2, 2, 3], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//H5图片
      SP: {base: '/splashscreen', pos: [], ran: 6, imgExt: ['jpg', 'jpeg']},//启动界面
      TB: {base: '/tagbanner', pos: [], ran: 6, imgExt: ['jpg', 'jpeg', 'png']},//标签通栏图
      TM: {base: '/tagmark', pos: [], ran: 6, imgExt: ['png']},//标签贴图
      SD: {base: '/slider', pos: [], ran: 6, imgExt: ['jpg', 'jpeg', 'png']}//轮播图片
    },
    activity_img_url: 'http://img-test.yueniapp.com/img/activity/',//活动宣传图片url
    avatar_url: 'http://img-test.yueniapp.com/avatar',//自定义头像url
    default_avatar_url: 'http://img-test.yueniapp.com/avatar/default',//默认头像url
    tag_url: 'http://img-test.yueniapp.com/tag',//自定义标签url
    default_tag_url: 'http://img-test.yueniapp.com/tag/default',//默认标签url
    img_url: 'http://img-test.yueniapp.com/img',//帖子图url
    video_url: 'http://192.168.61.10/video',//视频url
    video_play_suffix: '!videoplay',//视频开始截图后缀
    video_screenshot_suffix: '!screenshot',//视频屏幕截图后缀
    bucket: 'inmm-test',
    api_secret: 'jhQHCb0DX8dY9gbCYHBpMbX3Z40=',
    upload_url: 'http://v0.api.upyun.com',
    tag_suffix_middle: '.jpg!jpg150',//滤镜
    tag_suffix_min: '.jpg!jpg75',//标签小图
    suffix: '!jpg600',//帖子图
    suffix_min: '!jpg75',//帖子小图
    avatar_suffix: '.jpg!jpg300x300',//用户头像图
    avatar_suffix_default: '.jpg!jpg75',//用户头像图
    slider_url: 'http://img-test.yueniapp.com/slider',//轮播图目录
    tagmark_url: 'http://img-test.yueniapp.com/tagmark',//标签贴图目录
    tagbanner_url: 'http://img-test.yueniapp.com/tagbanner',//标签通栏图目录
    splashscreen_url: 'http://img-test.yueniapp.com/splashscreen',//启动画面图片url
    h5pic_url: 'http://img-test.yueniapp.com/h5/h',//h5图片url
    purge_url: 'http://purge.upyun.com/purge/',//刷新又拍云图片调用地址
    user: 'inmm01',
    pass: 'dkj34hFgAa9',
    token: '01ad63ee1239ebb3e47e5024d63166d5' //用户密码的md5
  },

  // 高德参数配置
  amap: {
    api_ver: 3,
    api_key: '891276fb426e6b189d23c1376f05feca',
    poi_info_url: 'http://restapi.amap.com/v3/place/detail',
    poi_info_s: 'rsv3',
    referer: 'http://admin.yn.com/',
    poi_rest_convert_url: 'http://restapi.amap.com/v3/assistant/coordinate/convert',
    api_rest_key: 'c08b88a4d14140ee1ad21af757cf800b'
  },

  //h5 地址
  h5config: {
    hurl: 'http://192.168.61.10/h5/h-'
  },

  //置顶帖
  threadup: {//里面的id对应轮播的id
    recommend: 86,//推荐
    newest: 87//最新
  },
  //帖子类别设置
  threadCategory: {
    default_category: 21,
    thread_certain_percentage: 0.7,
    SPAM_thread_array: [25, 27, 28, 29, 30, 31, 32, 33],
    SPAM_unique_category: 27,
    client_filter_parent_category: 39
  },

  // 点赞马甲过滤列表
  vest_filter: [2, 605, 606, 607, 608],

  // mongodb 设置
  mongo: {
    uri: 'mongodb://' + (process.env.CS_MONGO || 'localhost') + ':27017/yueniapp',
    options: {
      db: {native_parser: true},
      auto_reconnect: 1,
      server: {poolSize: 4},
      user: 'yueniapp',
      pass: 'kjhDh38273erdfEd'
    }
  },
  youku: {
    client_id: '84e14879ac1d5dbe',
    android_height: 150,
    ios_height: 133
  },
  lard_tagid: 371, //随便聊聊标签id

  // 瀑布.im 机器人配置
  pubuIM: {
    url: 'https://hooks.pubu.im/services/kzdd4x696pr60yb',
    displayUser: {
      name: "测试环境",
      avatarUrl: 'https://beta.pubu.im/img/services/custom.png'
    }
  }
};